//LittlePig
#include<bits/stdc++.h>
using namespace std;
int t;
int n,m;
int a[111111];
int c[111111];
int nk;
string sk[111];
int main()
{
    freopen("arena.in","r",stdin);
    freopen("arena.out","w",stdout);
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&a[i]);
    }
    for(int i=1;i<=m;i++)
    {
        scanf("%d",&c[i]);
    }
    int ic=n+1;
    while(ic!=0)
    {
        ic=ic/2;
        nk++;
    }
    for(int i=nk;i>0;i--)
    {
        cin>>sk[i];
    }
    scanf("%d",&t);
    for(int i=1;i<=t;i++) cout<<"5\n";
    return 0;
}
